var previous_tab = 'lang_1';

function showTab(obj){

	$("#"+previous_tab).toggleClass('active');
	$("#"+previous_tab+"_input").hide();
	$("#"+previous_tab+"_text").hide();
	
	var id = $(obj).attr("id");
	$(obj).toggleClass("active");
	$('#'+id+'_input').show();
	$('#'+id+'_text').show();
	previous_tab = id;
}

function showTab2(obj){

	$("#"+previous_tab).toggleClass('active');
	
	$("#"+previous_tab+"_text_container").hide();
	
	var id = $(obj).attr("id");
	$(obj).toggleClass("active");
	
	$('#'+id+'_text_container').show();
	previous_tab = id;
}

function changeCurSymbol(obj_id,id){
		var obj = document.getElementById(obj_id);
		var symbol = obj.options[obj.selectedIndex].id;		
		for (i=1; i<=3; i++)
		{
			if ($("#cur_symbol_"+i) != null)
				$("#cur_symbol_"+i).text(symbol);
		}
}

function changeCurName(obj_id,id){		
		var name = $("#"+obj_id).text();
		$("#currency_name_"+id).text(name);	
}

function changeCurWithType(id){
	var i=1;
	for(i=1;i<=3;i++){
		if(i!=id){			
			$("#price_"+i).attr("disabled","disabled");
			$("#id_currency_"+i).attr("disabled","disabled");
		}else{
			$("#price_"+i).removeAttr("disabled");
			$("#id_currency_"+i).removeAttr("disabled");
		}
	}
}

function enablePrice(type, number)
{
	var checkbox = document.getElementById('on_price_'+number);
	var field = document.getElementById('price_'+type);
	
	var price_count = 0;
	for (i=1; i<=3; i++)
	{
		var tmp_checkbox = document.getElementById('on_price_'+i);
		if (tmp_checkbox != null)
		{
			if (tmp_checkbox != checkbox && tmp_checkbox.checked == true)
				price_count++;
		}
	}
	
//	var other_type = 'dayly';
//	if (type == 'dayly') other_type = 'monthly';
	if (price_count > 0)
	{
		if (checkbox.checked == true)
			field.disabled = false;
		else if (checkbox.checked == false)
			field.disabled = true;
	}
	else
	{
		checkbox.checked = true;
	}
}

function switchOfferTypes(url)
{
	var form = document.getElementById('addoffer_form');
	form.action = url;
}

function Change(layer) {
 
	$("#"+layer).toggle();
	$("#mail_confirm_span").toggle();
	$("#password_confirm_span").toggle();
	$("#register_info").toggle();
}
